#ifndef PUDGE_META_VISITOR_TEST_HPP
#define PUDGE_META_VISITOR_TEST_HPP

#include <pudge/meta/visitor.hpp>

namespace pudge { namespace meta {

	/// NOTE: these tests may be a bit outdated.

	struct visitor_test_1_
	{
		typedef visitor<int,double> V;

		struct my_visitor
		{
			void operator() (int & i)
			{
				i = 5;	
			}
			void operator() (double & d)
			{
				d = 7.5;
			}
		};

		void operator ()()
		{
			typedef visitor<int,double> Visitor;
			typedef visitor<int,double>::client Client;

			int aint;
			double adouble;

			Visitor::clientr<int> int_client(aint);
			Visitor::clientr<double> double_client(adouble);

			Client * client_;

			client_ = &int_client;
			(*client_)(my_visitor());

			client_ = &double_client;
			(*client_)(my_visitor());

			if(aint != 5) throw -1;
			if(adouble != 7.5) throw -1;
		}
	} visitor_test_1;

	struct visitor_test_2_
	{
		struct my_visitor_ 
		{
			void operator()(int & i)
			{
				i = 69;
			}
		} my_visitor;

		void operator () ()
		{
			int aint;

			visitor<int>::clientr<int> client_(aint);
			client_(my_visitor);

			if(aint != 69) throw -1;
		}
	} visitor_test_2;

	void visitor_test()
	{
		visitor_test_1();
		visitor_test_2();
	}
}}

#endif